package org.cubikalabs.todolist.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	import org.cubikalabs.todolist.business.BusinessDelegate;
	import org.cubikalabs.todolist.event.TodoEvent;
	import org.cubikalabs.todolist.model.ModelLocator;
	
	public class SaveTodoCommand implements IResponder, ICommand
	{
		public function execute(event:CairngormEvent):void
		{
			new BusinessDelegate(this).saveTodo((event as TodoEvent).todo);
		}

		public function result(data:Object):void
		{
			trace("result UpdateTodoCommand")
			new GetTodoListCommand().execute(new CairngormEvent(""));
			
		}
		
		public function fault(info:Object):void
		{
			Alert.show("fails SaveTodoCommand")
		}
		
	}
}